package com.hongpu.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * hp_project_work_pay_list表中支付数据的明细表
 * @TableName hp_project_work_pay_list_detail
 */
@TableName(value ="hp_project_work_pay_list_detail")
@Data
public class HpProjectWorkPayListDetail implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    /**
     * 项目的回款与支出明细表的ID
     */
    @TableField(value = "hp_project_work_pay_list_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long hpProjectWorkPayListId;

    /**
     * 本期支付金额，本期支付金额不可大于剩余未支付金额
     */
    @TableField(value = "paid")
    private BigDecimal paid =  BigDecimal.ZERO;;

    /**
     * 支付时间
     */
    @TableField(value = "paid_time")
    @JsonFormat(pattern = "yyyy-MM-dd", locale = "zh_CN")
    private Date paidTime;


    /**
     * 实际时间
     */
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd", locale = "zh_CN")
    private Date actualTime;

    /**
     * 数据生成时间
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 录入人员的ID
     */
    @TableField(value = "create_by")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long createBy;


    /**
     * 备注
     */
    @TableField(value = "remark")
    private  String remark;

    /**
     * 逻辑删除字段
     */
    @TableLogic
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    private Integer deleted;




    /**
     * 数据修改时间
     */
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;



    /**
     * 数据修改操作人ID
     */
    @TableField(value = "update_by",fill = FieldFill.UPDATE)
    private Long updateBy;



    /**
     * 租户ID
     */
    @TableField(value = "tenant_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long tenantId;

    /**
     * 是否开发票。1=是，0=否
     */
    @TableField(value = "invoice_or_not")
    private Integer invoiceOrNot;

    /**
     * 是否已经对外开出发票。1=已开，0=未开
     */
    @TableField(value = "it_has_been_invoiced")
    private Integer itHasBeenInvoiced;

    /**
     * 发票类型；1=普票。2=增值税
     */
    @TableField(value = "invoice_type")
    private Integer invoiceType;

    /**
     * 发票税率
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    @TableField(value = "invoice_tax_rate")
    private BigDecimal invoiceTaxRate;

    /**
     * 不含税金额
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    @TableField(value = "amount_before_tax")
    private BigDecimal amountBeforeTax;

    /**
     * 税额
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    @TableField(value = "the_amount_of_tax_to_be_paid")
    private BigDecimal theAmountOfTaxToBePaid;
    /**
     * 是否更新合同金额
     */
    @TableField(exist = false)
    private String isUpdatetoTalContractAmount;

    // 添加的字段
    @TableField(exist = false)
    private Long parentId;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        HpProjectWorkPayListDetail other = (HpProjectWorkPayListDetail) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getHpProjectWorkPayListId() == null ? other.getHpProjectWorkPayListId() == null : this.getHpProjectWorkPayListId().equals(other.getHpProjectWorkPayListId()))
            && (this.getPaid() == null ? other.getPaid() == null : this.getPaid().equals(other.getPaid()))
            && (this.getPaidTime() == null ? other.getPaidTime() == null : this.getPaidTime().equals(other.getPaidTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getHpProjectWorkPayListId() == null) ? 0 : getHpProjectWorkPayListId().hashCode());
        result = prime * result + ((getPaid() == null) ? 0 : getPaid().hashCode());
        result = prime * result + ((getPaidTime() == null) ? 0 : getPaidTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", hpProjectWorkPayListId=").append(hpProjectWorkPayListId);
        sb.append(", paid=").append(paid);
        sb.append(", paidTime=").append(paidTime);
        sb.append(", createTime=").append(createTime);
        sb.append(", createBy=").append(createBy);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}